<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="portlet box blue">
	<div class="portlet-title">
		<div class="caption">
			<i class="fa fa-gift"></i>新建手工订单
		</div>
	</div>
	<div class="portlet-body form">
		<form id="ordertForm" class="form-horizontal form-bordered"
			action="/ordert/save" method="post">

			<div class="ebayform-top">
				<span>销售渠道</span> <select style="width: 80%; margin-left: 20px;"
					name="salechannel">
					<c:forEach items="${plist}" var="p" varStatus="vs">
						<option value="${p.id}">${p.name}</option>
					</c:forEach>
				</select> <br> <br> <span>账户名称</span><input type="text"
					style="width: 80%; margin-left: 20px;" name="accountname" /><br>
				<br> <span>订单号</span><input type="text"
					style="width: 80%; margin-left: 33px;" name="orderid" />

			</div>

			<div class="ebayform-second">
				<label>订单概要</label><br> <br> <span>付款形式:</span><input
					type="checkbox" style="margin-left: 20px;" name="checkpend" />该订单已付款<br>
				<br> <span>支付形式:</span><input type="text"
					style="width: 30%; margin-left: 20px;" placeholder="支付宝"
					name="paymethod" /><span style="margin-left: 50px;">支付日期:</span><input
					type="text" placeholder="2017-6-23 12:57:53" name="paydate"
					style="width: 30%; margin-left: 20px;" /><br> <br> <span>总支付:</span><input
					type="text" style="width: 30%; margin-left: 33px;" name="totalpay" />
			</div>

			<div class="ebayform-second">
				<label>收货人信息</label><br> <br> <span>收货人:</span><input
					style="width: 80%; margin-left: 33px;" name="receivername" /><br>
				<br> <span>地址:</span><input
					style="width: 80%; margin-left: 46px;" name="address" /><br>
				<br> <span>手机号:</span><input type="text"
					style="width: 30%; margin-left: 33px;" name="phone" /><span
					style="margin-left: 50px;">邮编:</span><input type="text"
					style="width: 30%; margin-left: 20px;" name="postalcode" />
			</div>

			<div class="ebayform-second">
				<label>发货信息</label><br> <br> <span>发货仓库:</span> <select
					style="width: 80%; margin-left: 16px;" name="warsehose">
					<c:forEach items="${warehouses}" var="w" varStatus="vs">
						<option value="${w.id}">${w.name}</option>
					</c:forEach>
				</select> <br> <br> <span>邮寄方式:</span> <select id="logisticsId"
					style="width: 80%; margin-left: 16px;" name="shiptype">
					<c:forEach items="${loglist}" var="log" varStatus="vs">
						<option value="${log.id}">${log.name}</option>
					</c:forEach>
				</select> <br> <br> <span>运单号:</span><input
					style="width: 80%; margin-left: 33px;" name="shipnumid" />
			</div>


			<div class="ebayform-second">
				<label>备注</label><br> <br>
				<textarea class="form-control" rows="3" name="note"></textarea>
			</div>

			<div class="ebayform-second">
				<label>商品信息</label><label style="margin-left: 50px;">请选择商品</label><br>
				<br>
				<table class="table table-striped table-hover table-info"
					style="width: 95%;">
					<thead>
						<tr>
							<th>商品名称</th>
							<th>商品SKU</th>
							<th>单价</th>
							<th>数量</th>
							<th>当前库存</th>
							<th>发货SKU</th>
							<th>总价</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td><input type="text" placeholder="沙滩伞" name="productname1" /></td>
							<td><input type="text" placeholder="PG17HW186EG" name="sku1" /></td>
							<td><input type="text" placeholder="200" name="price1"></td>
							<td><input type="text" placeholder="200" name="amount1" /></td>
							<td><input type="text" placeholder="100"
								name="currentstock1" /></td>
							<td><input type="text" placeholder="PG17HW186EG"
								name="shipsku1" /></td>
							<td><input type="text" placeholder="200" name="totalprice1" /></td>
						</tr>
						<tr>
							<td><input type="text" placeholder="沙滩伞" name="productname2" /></td>
							<td><input type="text" placeholder="PG17HW186EG" name="sku2" /></td>
							<td><input type="text" placeholder="200" name="price2" /></td>
							<td><input type="text" placeholder="200" name="amount2" /></td>
							<td><input type="text" placeholder="100"
								name="currentstock2" /></td>
							<td><input type="text" placeholder="PG17HW186EG"
								name="shipsku2" /></td>
							<td><input type="text" placeholder="200" name="totalprice2" /></td>
						</tr>

					</tbody>
				</table>
			</div>



			<div class="form-actions">
				<div class="col-md-9 col-md-offset-3">
					<button type="button" class="btn btn-primary"
						onclick="newHandOrder()">
						<spring:message code="btn.save"></spring:message>
					</button>
					<button type="reset" class="btn btn-default" onclick="cancel()">
						<spring:message code="btn.return"></spring:message>
					</button>
				</div>
			</div>
			<input type="hidden" name="id" value="${ordert.id}">
		</form>
	</div>
</div>
<style type="text/css">
.ebayform-top, .ebayform-second {
	padding: 2%;
	border: 1px solid #C1C1C1;
}

.ebayform-second label {
	font-size: 16px;
	font-weight: bold;
}
</style>
<script type="text/javascript"
	src="<c:url value="/static/custom/datepicker-util.js"></c:url>"></script>
<script type="text/javascript">
	function newHandOrder() {

		$.ajax({
			type : 'post',
			url : webRoot + $('#ordertForm').attr('action'),
			data : $('#ordertForm').serialize(),
			dataType : 'json',
			success : function(data) {
				alert(data.result)
				search();
				$(".panel-search").show();

			}
		});

	}
</script>